Skip to main content

MSI Laptop 3 — API Server Documentation

Ubuntu Server 24.04 host for Python APIs behind Nginx. This folder documents server layout, conventions, and procedures so any technician can deploy or extend the stack without relying on chat history.

Server at a glance

ItemValue
OSUbuntu Server 24.04
Hostnamemsi-laptop-3
Public static IP (Ethernet enp58s0)74.83.141.228
Public DNShydrotrek.org, www.hydrotrek.org → A → 74.83.141.228
RoleReverse-proxy host for DWD agent APIs (client gqc)
EdgeNginx (80/443) → localhost-only app ports 8001–8003
Process managersystemd (native now; Docker target)
Current phaseFirst API live; sprint: MCP + Copilot Docker (14-sprint-copilot-mcp-docker.md)

Documentation index

DocumentPurpose
docs/01-directory-layout.mdStart here. FHS-aligned paths, ownership, permissions, naming
docs/02-adding-a-new-api.mdStep-by-step checklist to add another API
docs/03-systemd-service.mdsystemd unit pattern, env loading, logging
docs/04-nginx-reverse-proxy.mdSubdomain routing, SSL termination (when ready)
docs/05-docker-strategy.mdDocker vs native; what changes on the host
docs/06-dockerizing-dwd-api-fastapi.mdFirst API container walkthrough
docs/07-code-management-and-git.mdDeploy keys vs personal SSH; Git on server vs registry
docs/08-docker-install-and-users.mdDocker install; gqc / apisvc / docker groups
docs/09-wifi-and-ssh-network-setup.mdWi‑Fi enable; SSH on wlan only; UFW per interface
docs/10-deploy-dwd-api-fastapi-server.mdDeploy first API on server — Docker copy-paste runbook
docs/11-nginx-lan-setup.mdNginx port 80 on LAN IP (pre–server room)
docs/12-nvidia-gpu-todo.mdTODO — NVIDIA drivers, nvidia-smi, optional Docker GPU
docs/13-cors-and-browser-api.mdCORS in FastAPI vs Nginx; LAN dev troubleshooting
docs/14-sprint-copilot-mcp-docker.mdSprint — MCP + Copilot Docker, Nginx, cross-service URLs
docs/16-hydrotrek-org-production-cutover.mdProduction — static IP, SSL, DNS, env URLs
templates/Copy-paste templates for env, systemd, Nginx, Docker, netplan

Standard layout (summary)

/opt/apis/<api-name>/          Application source (git checkout)
/opt/venvs/<api-name>/ Dedicated Python virtual environment
/etc/<api-name>/ Host config and secrets (not in git)
/etc/systemd/system/ systemd unit files
/etc/nginx/sites-available/ Nginx server blocks
/var/log/<api-name>/ Optional file logs (journald is default)

Run all API processes as an unprivileged service account (apisvc) in native mode, bind apps to 127.0.0.1 only, and never expose app ports through the firewall. In Docker mode, map 127.0.0.1:<port>:8080 — see docs/05-docker-strategy.md.

Workstation layout

repos/                         Local git clones (Docker dev, review)
hydrotrek-dwd-suite/ Super-repo (submodules + stack Docker compose)
dwd-api-fastapi/ Flat clone (also submodule in suite)
dwd-mcp-fastmcp/
dwd-copilot-server/
docs/ Server runbooks
templates/ Config and Docker templates
scripts/ Server setup scripts

Stack orchestration (Compose, dwd-stack network, Nginx path routing): repos/hydrotrek-dwd-suite/docker/. Per-service Dockerfile files stay in each submodule repo.

Server paths (/opt/apis/, /etc/<api-name>/) are documented in docs/01-directory-layout.md.

Completed on server

  • SSH with key authentication from Windows workstation
  • Laptop power management (suspend masked; logind lid settings verified)
  • Base packages: nginx, git, curl, unzip, python3, python3-pip, python3-venv, ufw
  • NVIDIA driver: nvidia-driver-595-opennvidia-smi OK (RTX 4070 Max-Q, 595.71.05)

Deferred / in progress

Wi‑Fi (enable before or during office setup)

  • Headless Server may need wpasupplicant, firmware-iwlwifi, and netplan Wi‑Fi config
  • Ethernet = production; Wi‑Fi = admin SSH path (behind VPN)
  • Full runbook: docs/09-wifi-and-ssh-network-setup.md

Open decisions

TopicCurrent choiceNotes
RoutingSubdomains (preferred)e.g. customer.example.com
DeploymentTBDManual git pull vs CI/CD
RuntimeNative first → DockerBoss requirement; see docker docs
SSLExisting cert via NginxLet's Encrypt optional later
Azure authService principal or SASSecrets in /etc/<api-name>/

Deployed APIs

ServiceRepoContainer portHost (127.0.0.1)Nginx (LAN)Status
dwd-api-fastapirepos/dwd-api-fastapi80808001/gqc/api/fastapi/deploy doc
dwd-mcp-fastmcprepos/dwd-mcp-fastmcp80818002/gqc/api/mcpStack: hydrotrek-dwd-suite/docker
dwd-copilot-serverrepos/dwd-copilot-server80828003/gqc/api/copilotkitStack: hydrotrek-dwd-suite/docker

Browser: https://www.hydrotrek.org/gqc/api/... (public). / returns 404. Docker DNS unchanged.

Sprint checklist (MCP + Copilot): docs/14-sprint-copilot-mcp-docker.md

TODO

ItemStatusDoc
NVIDIA nvidia-smi installed and workingDone (595.71.05, RTX 4070 Max-Q)docs/12-nvidia-gpu-todo.md